package com.dp.demo.config;

import com.dp.demo.service.GoodsClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

/**
 * @Author: dupeng
 * @CreateTime: 2024-12-11  15:13
 * @Description: TODO
 */
@Slf4j
public class GoodsClientFallbackFactory implements FallbackFactory<GoodsClient> {
    @Override
    public GoodsClient create(Throwable cause) {
        return new GoodsClient() {
            @Override
            public String getHello() {
                log.error("goods server is not available");
                return "goods服务降级";
            }

            @Override
            public void remoteSave() {
                log.error("goods server is not available");
            }
        };
    }
}
